package com.csw.controller;

import com.csw.entity.File;
import com.csw.entity.User;
import com.csw.service.DirService;
import com.csw.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @author Administrator
 */
@RequestMapping("latest")
@RestController
public class LateSrcController {
    @Autowired
    private FileService fileService;
    @Autowired
    private DirService dirService;

    @RequestMapping("queryAll")
    public String queryAll(HttpSession session) {

        User user = (User) session.getAttribute("user");
            if (user == null) {
                return "redirect:/user/logOut";
            }
            int ststus = 1;
            //查找，当前用户，正常状态下的文件
            List<File> files = fileService.queryLater(user, ststus);
            session.setAttribute("files", files);
            return "redirect:/jsp/front/main/detail/later.jsp";

    }


}
